Ext.define('AmpleHarvest.objects.Statistics.view.UserByOrgPie',
		{
			extend			: 'AmpleHarvest.objects.Statistics.absPanel',
			uses			:
			[
				'AmpleHarvest.DATA.Store.statistics.cUserByOrg'
			],
			title			: 'Users By Organization',
			layout			: 'fit',
			html			: '<p>I will show Users by org</p>',
			initComponent	: function()
			{
				var obj_This = this;
				this
						.setStore(Ext
								.create('AmpleHarvest.DATA.Store.statistics.cUserByOrg'));

				this.m_obj_Chart = Ext.create('AmpleHarvest.objects.chart.cExportable',
						{
							animate	: true,
							store	: this.getStore(),
							theme	: 'Base:gradients',
							legend	:
							{
								position	: 'right'
							},
							series	:
							[
									{
										type			: 'pie',
										field			: 'data',
										showInLegend	: true,
										tips			:
										{
											trackMouse	: true,
											width		: 140,
											height		: 40,
											renderer	: function(storeItem,
													item)
											{
												// calculate and display
												// percentage on hover
												var total = 0;
												obj_This.getStore().each(function(rec)
														{
															total += parseInt(rec
																	.get('data'));
														}
												);
												this
														.setTitle(storeItem
																.get('label')
																+ ': '
																+ Math
																		.round(storeItem
																				.get('data')
																				/ total
																				* 100)
																+ '% <br/> '
																+ storeItem
																		.get('data'));
											}
										},
										highlight		:
										{
											segment	:
											{
												margin	: 20
											}
										},
										label			:
										{
											field		: 'label',
											display		: 'rotate',
											contrast	: true,
											font		: '18px Arial'
										}
									}
							]
						}
				);
				this.callParent();
				this.getStore().on("beforeload", this.showMask, this);
				this.getStore().on("load", this.hideMask, this);

				this.on("render", this.updateData, this);
				this.add(this.m_obj_Chart);
			}
		}
);